package com.chezai.client.update;

import com.chezai.client.utils.Util;
import com.orhanobut.logger.Logger;

import org.xutils.http.app.ResponseParser;
import org.xutils.http.request.UriRequest;

import java.lang.reflect.Type;
import java.util.List;

/**
 * 解析AppUpdate结果
 * Created by likunyang on 2017/9/5.
 */

public class AppUpdateResponseParser implements ResponseParser {
    private String TAG = this.getClass().getSimpleName();

    @Override
    public void checkResponse(UriRequest request) throws Throwable {

    }

    @Override
    public Object parse(Type resultType, Class<?> resultClass, String result) throws Throwable {
        Logger.t(TAG).i("开始解析升级信息：" + result);
        if (resultClass == List.class) {
            List<AppUpdateInfo> resultList = Util.parseJsonToList(result, AppUpdateInfo.class);
            return resultList;
        }
        return null;
    }
}
